<form class="layui-form" method="post">
    <div class="layui-form-item" style="padding-top: 2%">
        <label class="layui-form-label">站点名称：</label>
        <div class="layui-input-inline">
            <input type="text" name="urlname" lay-verify="required" maxlength="64" value="{$date.site_name}"  placeholder="输入站点名称" autocomplete="off"  id="urlname" class="layui-input  <if condition="$date['site_id'] neq null">layui-disabled</if>"<if condition="$date['site_id'] neq null">disabled</if>>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">站点域名：</label>
        <div class="layui-input-inline">
            <input type="text" name="url" lay-verify="required|url" maxlength="40" placeholder="http://www.adidas.com.cn"value="{$date.site_url}" autocomplete="off" id="url" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">站点状态：</label>
        <div class="layui-input-inline">
            <input type="checkbox" name="switch" lay-skin="switch" lay-text="开启|关闭" <if condition="$date['site_status'] eq 1">checked</if> >
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="sitesub">提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script>
        form.render();
        form.on('submit(sitesub)', function(data){
            var userInfo = data.field;
            var url = "__SELF__";
            $.post(url,userInfo,function(data){
                if(data.code == '4001'){
                    layer.msg(data.msg,{icon: 5});
                    return;
                }else if(data.code == '101'){
                    layer.msg(data.msg, {
                        icon: 6,
                        time: 2000
                    }, function(){
                        location.reload();
                    });
                }else{
                    layer.msg("数据错误",{icon: 5});
                    return;
                }
            });

            return false;
        });

</script>